<?php
namespace app\portal\controller;

use cmf\controller\HomeBaseController;
use app\wechat\controller\User;
use think\Db;

class PersonController extends HomeBaseController
{

	//评价中心页面
	public function index()
	{
		$userid = cmf_get_current_user_id();
		$user = Db::name('member')
        ->alias('a')
        ->join('cmf_wechat_tag_user b','a.openid=b.userid')
        ->where('a.id',$userid)
        ->column('b.tagid');
    	if (in_array(config('meet_admin'), $user)) {
            $user_type = 3;
        }elseif(in_array(config('meet'), $user)){
            $user_type = 2;
        }elseif(in_array(config('fix'), $user)){
            $user_type = 4;
        }elseif (in_array(config('meet_vip'), $user)) {
            $user_type = 5;
        }else{
            $user_type = 1;
        }

        // if (in_array(config('fix'), $user)) {
        //     $fix_user_type = 1;//维修工
        //     $this->assign('fix_user_type',$fix_user_type);
        // }
        $this->assign('user_type',$user_type);//1:普通用户 2:会务员查看 3: 会议管理员

		$data = Db::name('member')
        ->alias('a')
        ->join('cmf_wechat_department_user b','a.openid=b.user_id')
        ->join('cmf_wechat_department c','c.id=b.department_id')

        ->field('a.user_login,c.name,a.mobile')
        ->where('a.id',$userid)
        ->find();
		$this->assign('data',$data);
		return $this->fetch();
	}
}